#pragma once

class Direct3D
{
    private:

        static void InvalidateDeviceObjects();
        static int RestoreDeviceObjects();
        static void Render();
        static int NeedReset();
        static void Free_Impl();

    public:

        static LPDIRECT3DTEXTURE9 CursorSurface;
        static const int CursorMaxWidth = 64;
        static const int CursorMaxHeight = 64;

        static const TCHAR* Init(HWND ahwnd, int w_w, int w_h, int t_w, int t_h, int depth);
        static void Free();

        static bool CanShaders();
        static int GoodEnough();

        static void GetPixelFormat(int depth, int* rb, int* bb, int* gb, int* rs, int* bs, int* gs, int* ab, int* ar, int* a);

        static void Refresh();
        static bool RenderFrame();
        static void ShowFrame();

        static byte* LockTexture(int*, int);
        static void UnlockTexture();
        static void FlushTexture(int miny, int maxy);
        static byte* GetFilterBuffer(int* widthp, int* heightp, int* pitch, int* depth);

        static void GUIMode(int guion);

        static HDC GetDC();
        static HDC ReleaseDC(HDC hdc);

        static void SetCursor(int x, int y, int visible);

        static bool IsVerticalBlank();
        static double GetRefreshRate();
        static bool WaitVertBlankState(bool state);
        static bool VertBlankBusyWait();
};